public class ThreadDemo {
    private static int count = 0;
    public static void main(String[] args) {
        Thread t1 = new Thread(){
            @Override
            public void run() {
                for (int i = 0; i < 50000; i++) {
                    count++;
                }
            }
        };
        Thread t2 = new Thread(){
            @Override
            public void run() {
                System.out.println(count);
            }
        };
        t1.start();
        t2.start();
    }
}
